var BASE_DIR = __dirname + '/../';
var UTIL = BASE_DIR + '/util/';

var StringUtil = require(UTIL + 'StringUtil');
var assert = require('assert');
var fs = require('fs');

// assert(StringUtil.isBlank(null));
assert(StringUtil.isBlank(""));
assert(StringUtil.isBlank("   "));
assert(StringUtil.isBlank("\t"));
assert(StringUtil.isBlank("\n"));
assert(StringUtil.isBlank("\f"));
assert(StringUtil.isBlank("\r"));
assert(StringUtil.isBlank("\n\f\r"));
assert(!StringUtil.isBlank("\n\f\rdssd"));

var xml = fs.readFileSync('test.xml').toString();
var xml = StringUtil.replaceXMLBlank(xml);
var oneLineXml = fs.readFileSync('oneLine.xml').toString();
assert(oneLineXml === xml);

var CerID = StringUtil.getValueByTag('CerID',xml);
assert('56445F07' === CerID);

var xml = StringUtil.replaceValueByTag('CerID','22223333',xml);
var replaceXml = fs.readFileSync('replaceXml.xml').toString();
assert(replaceXml === xml);
